// pages/settingdetails/settingdetails.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    news_id: '',
    groupId: '',
    cate_title: '',
    groupName: '',
    is_invite: '',
    is_contact: '',
    groupDescription: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options.news_id);
    var that = this
    that.setData({
      news_id: options.news_id
    })
    wx.request({
      url: app.globalData.url + 'Group/basic',
      data: {
        openid: wx.getStorageSync('openid'),
        news_id: options.news_id,
      },
      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      success: function (res) {
        console.log(res);
        if (res.data.status === 1) {
          that.setData({
            groupId: res.data.data.id,
            cate_title: res.data.data.cate_title,
            groupName: res.data.data.title,
            is_invite: res.data.data.is_invite,
            is_contact: res.data.data.is_contact,
            groupDescription: res.data.data.description,

          })
        } else if (res.data.status === 0) {
          wx.showToast({
            title: res.data.msg,
            // icon: 'success',
            duration: 2000
          })
        }
      },
      fail: function () {
        // fail
      },
      complete: function () {
        // complete
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})